package com.dv.shell.utils;

import java.util.Random;

/**
 * @Author DavidLoman
 * @create 2021/6/8 22:55
 */
public class KeyUtil {

    /**
     * 生成唯一主键
     * 时间+随机数
     */
    public static synchronized String genUniqueKey() {

        Random random = new Random();

        int nextInt = random.nextInt(900000) + 100000;
        String uniqueKey = System.currentTimeMillis() + String.valueOf(nextInt);
        return uniqueKey;
    }
}
